import request from '@/router/axios'

export function fetchTableList(obj) {  // 查询客户列表
    return request({
      url: '/api/customer/member/page',
      method: 'post',
      data:obj
    })
}

// 客户360°视图
export function fetchbasciList(obj) { // 基础信息
  return request({
    url: '/api/customer/member/basic/'+ obj.memberId,
    method: 'post',
    data:obj
  })
}

export function fetchsocialList(obj) { // 社交账号
  return request({
    url: '/api/customer/member/social/' + obj.memberId,
    method: 'post',
    data:obj
  })
}

export function fetchtardeList(obj) { // 交易记录
  return request({
    url: '/api/transaction/transactionQuery',
    method: 'post',
    data:obj
  })
}

export function fetchIntegral(obj) { // 积分流水
  return request({
    url: '/api/loyalty/points/page',
    method: 'post',
    data:obj
  })
}

// export function fetchCommunication(obj) { // 沟通记录
//   return request({
//     url: '/api/transaction/transactionQuery',
//     method: 'post',
//     data:obj
//   })
// }

export function addCustomer(obj) { // 积分流水
  return request({
    url: '/api/customer/member',
    method: 'post',
    data:obj
  })
}

export function targetDataList(obj){//根据target id查询客户列表
  return request({
    url: '/api/customer/target/customerlist',
    method: 'post',
    data:obj
  })
}
export function customerTargetTableList(obj){//客户分组列表
  return request({
    url: '/api/customer/target/page',
    method: 'post',
    data:obj
  })
}

export function targetCategoryTableList(obj){//客户分组分类列表
  return request({
    url: '/api/customer/targetCategory/list',
    method: 'post',
    data:obj
  })
}

export function addTargetCategory(obj){//新增客户分组分类
  return request({
    url: '/api/customer/targetCategory',
    method: 'post',
    data:obj
  })
}

export function editTargetCategory(obj){//编辑客户分组分类
  return request({
    url: '/api/customer/targetCategory',
    method: 'put',
    data:obj
  })
}

export function delTargetCategory(id){//删除客户分组分类
  return request({
    url: '/api/customer/targetCategory/'+id,
    method: 'delete',
  })
}

export function copyTargetGroup(obj){//复制
  return request({
    url: '/api/customer/target/copy',
    method: 'post',
    data:obj
  })
}

export function moveTargetGroup(obj){//移动
  return request({
    url: '/api/customer/target/move',
    method: 'post',
    data:obj
  })
}

export function delTargetGroup(id){//删除
  return request({
    url: '/api/customer/target/'+id,
    method: 'delete',
  })
}

export function criteriaList(obj){//客户筛选条件列表
  return request({
    url: '/api/customer/criteria/list',
    method: 'post',
    data:obj
  })
}

export function targetSum(obj){//客户筛选条件列表
  return request({
    url: '/api/customer/target/sum',
    method: 'post',
    data:obj
  })
}

export function criteriaListAll(obj){
  return request({
    url: '/api/customer/criteria/all',
    method: 'post',
    data:obj
  })
}

// 渠道列表
export function fetchChannelList(obj) {  // 查询订单列表
  return request({
    url: '/api/basic/channel/displaylist',
    method: 'get',
    data:obj
  })
}

// 商品分页列表
export function fetchProductList(obj) {  // 查询订单列表
  return request({
    url: '/api/basic/product/productQuery',
    method: 'POST',
    data:obj
  })
}
//等级
export function fetchLeveltList(obj) {  // 查询订单列表
  return request({
    url: '/api/customer/levelRule/list',
    method: 'POST',
    data:obj
  })
}
//保存分组
export function targetSave(obj) {  // 查询订单列表
  return request({
    url: '/api/customer/target/save',
    method: 'POST',
    data:obj
  })
}

export function targetNameSearch(obj) {  // 分组名称搜索检查
  return request({
    url: '/api/customer/target/name/search',
    method: 'POST',
    data:obj
  })
}
//查看分组信息
export function getTargetById(id){//删除客户分组分类
  return request({
    url: '/api/customer/target/'+id,
    method: 'get',
  })
}


export function getDetailByid(id) { // 编辑查看信息
  return request({
    url: '/api/customer/member/detail/'+id,
    method: 'post'
  })
}
